package com.isoftstone.merchant.dao.feeUser;


import com.isoftstone.common.Page;
import com.isoftstone.merchant.entity.feeUser.MFeeUser;
import com.isoftstone.util.PageData;
import org.apache.ibatis.annotations.Param;
import org.springframework.stereotype.Repository;

import java.util.List;
import java.util.Map;

@Repository
public interface MFeeUserMapper {

    int deleteByPrimaryKey(String key);

    /**
     * 移动端添加缴费用户
     * @param record
     * @return
     */
    int insert(MFeeUser record);

    int insertSelective(MFeeUser record);

    MFeeUser selectByPrimaryKey(@Param("feeId")String key);

    int updateByPrimaryKeySelective(MFeeUser record);

    int updateByPrimaryKey(MFeeUser record);

    List<MFeeUser> selectFeeUserlistPage( Page page);

    Integer selectFeeUserCountFromPayment(@Param("feeUserId") String feeUserId,@Param("feeStatus") String feeStatus,@Param("status")String status);

    Integer deleteFeeUserCountFromPayment(@Param("feeUserId")String feeUserId);

    void deleteFeeUser(@Param("feeUserId")String feeUserId);

    List<MFeeUser> selectExcelAllFeeUserList(Map<String,Object> map);

    Integer updateFeeUserStatus(PageData pd);

    Integer selectFeeId( @Param("feeId") String feeId,@Param("cropId")String cropId);

    Integer selectFeeId1(Map<String, Object> feeId);

    Integer selectFeeId2(@Param("feeId") String feeId, @Param("feeUserId") String feeUserId);

//    String selectFeeUserIdByFeeId(@Param("feeId") String feeId);
      String selectFeeUserIdByFeeId(MFeeUser mFeeUser);


    /**
     * 根据缴费单位id查询缴费编号
     */
    List<MFeeUser> queryFeeIdByCropId(@Param("cropId")String cropId ,@Param("openAccount")String openAccount) throws Exception;

    /**
     * 根据缴费编号查询缴费详细信息
     */
    MFeeUser queryFeeUserByFeeId(@Param("feeId") String feeId,@Param("corpId")String corpId) throws Exception;
    /**
     * 根据商户Id和缴费编号查询
     */
    MFeeUser queryFeeUserByCorpIdAndFeeId(@Param("feeId") String feeId, @Param("cropId")String cropId) throws Exception;

    /**
     * 根据corpId查询该缴费单位下的所有缴费编号
     */
    List<MFeeUser> getFeeIdByCropId(@Param("cropId")String cropId) throws Exception;

    /**
     * 缴费用户添加时根据商户id和缴费编号查询
     */
    MFeeUser getFeeUserByCorpIdAndFeeId(@Param("feeId") String feeId,@Param("cropId")String cropId) throws Exception;

    //线下收费获取部门主键
    String selectDeptId(@Param("feeUserId")String feeUserId);
    /**
     * 解约
     */
    void cancelContract(@Param("feeId") String feeId, @Param("corpId") String cropId, @Param("status") String status) throws Exception;

    /**
     * 申请绑定
     */
    void addFeeUser(MFeeUser feeUser) throws Exception;

    /**
     * 续约
     */
    void extentContract(@Param("feeId") String feeId, @Param("corpId") String corpId, @Param("status") String status) throws Exception;

    MFeeUser getfeeUserByFeeId(@Param("feeId") String feeId, @Param("corpId") String corpId)throws Exception;

    List<MFeeUser> getHandFeeUserlistPage(Page page)throws Exception;

    MFeeUser getCountFeeUser(Page page)throws Exception;

    Integer getAllUserNumber(Page page)throws Exception;

    Integer getTodayUserNumber(Page page)throws Exception;

    List<MFeeUser> getFeeUserByDeptId(@Param("deptId") String deptId)throws Exception;

    Integer getAllUserNumbers(PageData pd) throws Exception;

    Integer getTodayUserNumbers(PageData pd)throws Exception;
}